#ifndef GAME_H
#define GAME_H

#include "Singleton.h"

#include <QDebug>
#include <QList>
#include <QMap>
#include <exception>

class MyState {
  public:
    MyState(QString s=""):_msg(s){}
    ~MyState(){}
    QString _msg;
};

class Memento;
class Originator {
public:
    Originator(){ _state = new MyState("test"); }
    Memento* CreateMemento();
    void SetMemento(const Memento* m);
    virtual ~Originator(){}
    void PrintState(){
        qInfo() << __FUNCTION__ << _state->_msg;
    }
    void Handle(){
        _state->_msg += " Handle";
    }
private:
    MyState* _state;
};

class Memento {
  public:
    virtual ~Memento(){}
private:
    friend class Originator;
    Memento(){ _state = new MyState; }

    void SetState(MyState* s){ *_state = *s; }
    MyState* GetState(){ return _state; }
private:
    MyState* _state;
};



#endif // GAME_H
